package com.xtaller.lazy.service.system; 

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xtaller.lazy.base.TServiceImpl;
import com.xtaller.lazy.lib.convert.J;
import com.xtaller.lazy.mapper.system.DataLogMapper;
import com.xtaller.lazy.model.system.DataLog;
import lombok.var;
import org.springframework.stereotype.Service;
 
/** 
* 代码生成 
* @author: Taller  
* @date: 2019/04/20
* @Description: 数据操作日志服务 
*/ 
@Service 
public class DataLogService extends TServiceImpl<DataLogMapper, DataLog>{
    private final String IS_DELETE = "isDelete";
    public void log(DataLog log){
        // 先读取最后一次更新的数据
        var qw = new QueryWrapper<DataLog>();
        qw.lambda().orderByDesc(DataLog::getCreateTime);
        var list = this.list(qw);
        if(list.size() == 0){
            // 这是新增数据
        }else{
            // 修改或者删除数据
            var json = J.o2j(log);
            if(json.get(IS_DELETE) != null && json.get(IS_DELETE).equals(1)){

            }else{

            }
        }
    }
}
